package com.zdsoft.blp.zongbuju.shouye.linliquan.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.zdsoft.blp.R;
import com.zdsoft.blp.zongbuju.shouye.linliquan.adapter.LinLiDialogAdapter;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/9/2.
 */
public class LLShiChangDialog extends AppCompatActivity{
    private ListView lv_dialog;
    private List<String> list;

   @Override
    protected void onCreate( Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
       setContentView(R.layout.linli_dialog);
       //这是加载布局是充满activity
       getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
       lv_dialog = (ListView) findViewById(R.id.lv_dialog);
       lv_dialog.setAdapter(new LinLiDialogAdapter(getDate(),LLShiChangDialog.this));
       lv_dialog.setOnItemClickListener(new AdapterView.OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
               Intent intent = getIntent();
               String category= list.get(position);
               intent.putExtra("leibie",category);
               setResult(RESULT_OK,intent);
               finish();
           }
       });
    }

    public List<String> getDate() {
        list = new ArrayList<>();
        list.add("数码产品");
        list.add("音像");
        list.add("美容保健");
        list.add("家具日用品");
        list.add("母婴用品");
        list.add("服饰用品");
        list.add("家具家电");
        list.add("办公用品");
        list.add("其他");
        return list;
    }

}
